//Sat Jul 17 20:35:41 CDT 2010
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

class Badgers
{
public:
	int feedMost(vector<int> hunger, vector<int> greed, int totalFood)
	{
		int N = hunger.size();
		for (int ncase = N; ncase >= 0; ncase--)
		{
			vector<int> takes;
			for (int i = 0; i < N; i++)
			{
				takes.push_back(hunger[i] + (ncase - 1) * greed[i]);
			}
			sort(takes.begin(), takes.end());
			int total = totalFood;
			for (int i = 0; i < ncase; i++)
			{
				total -= takes[i];
			}
			if (total >= 0)
				return ncase;
		}
		return 0;
	}
};
